﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameRoot : MonoBehaviour
{
    private AudioSource music;
    // Start is called before the first frame update
    void Start()
    {
        music = this.GetComponent<AudioSource>();
        //音乐音量本地存储、读取
        if(!PlayerPrefs.HasKey("MusicVolume"))
        {
            PlayerPrefs.SetFloat("MusicVolume", 0.3f);
            PlayerPrefs.Save();
        }
        music.volume = PlayerPrefs.GetFloat("MusicVolume");
        music.Play();
        //音效音量本地存储
        if (!PlayerPrefs.HasKey("EffectsVolume"))
        {
            PlayerPrefs.SetFloat("EffectsVolume", 0.5f);
            PlayerPrefs.Save();
        }

        UIManager.Instance.PushPanel("MainMenuPanel");        
    }

}
